﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ShotURL.Controllers
{
    public class TransfomUrl
    {
        private char[] _TransfomUrl = new char[8];

        public string Transfom(string longUrl)
        {
            Random rnd = new Random(longUrl.GetHashCode());
            int r;
            for (int i = 0; i < 8; i++)
            {
                while (_TransfomUrl[i] == '\0')
                {
                    r = rnd.Next(47, 123);
                    if (r < 58 || r > 64 && r < 91 || r > 96)
                        _TransfomUrl[i] = (char)r;
                }
            }
            return new string(_TransfomUrl);
        }
    }
}